import Cookies from 'js-cookie'

const TokenKey = 'Agriculture-Personal-Token'
const TenantIdKey = 'TENANT_ID'
const OAuth2AccessToken = 'OAuth2AccessToken'
const OAuth2RefreshToken = 'OAuth2RefreshToken'

// export function getToken() {
//   return Cookies.get(TokenKey)
// }
//
// export function setToken(token) {
//   return Cookies.set(TokenKey, token)
// }
//
// export function removeToken() {
//   return Cookies.remove(TokenKey)
// }

export function getToken() {
    // return Cookies.get(TokenKey)
    return window.localStorage.getItem(TokenKey)
}

export function setToken(token) {
    return window.localStorage.setItem(TokenKey, token)
    // return Cookies.set(TokenKey, token)
}

export function removeToken() {
    // return Cookies.remove(TokenKey)
    return window.localStorage.removeItem(TokenKey)
}

export function setTenantId(username) {
    localStorage.setItem(TenantIdKey, username)
}
export function getTenantId() {
    return localStorage.getItem(TenantIdKey)
}

export function getOAuth2AccessToken() {
    return window.localStorage.getItem(OAuth2AccessToken)
}

export function setOAuth2AccessToken(token) {
    return window.localStorage.setItem(OAuth2AccessToken, token)
}

export function removeOAuth2AccessToken() {
    return window.localStorage.removeItem(OAuth2AccessToken)
}

export function getOAuth2RefreshToken() {
    return window.localStorage.getItem(OAuth2RefreshToken)
}

export function setOAuth2RefreshToken(token) {
    return window.localStorage.setItem(OAuth2RefreshToken, token)
}

export function removeOAuth2RefreshToken() {
    return window.localStorage.removeItem(OAuth2RefreshToken)
}
